<?php
class Myblog_Form_Contact extends Zend_Form
{
	public function init()
	{
	$this->setAction('/contact')
		->setMethod('post');

	$from= new Zend_Form_Element_Text('name');
	$from->setLabel('Ваше Имя: ')
		->setOptions(array('size'=>15,'id'=>'title'))
		->setRequired(true)
		->addValidator('NotEmpty',true)
		->addFilter('StringTrim')
		->addFilter('HtmlEntities');
	
	$to= new Zend_Form_Element_Text('to');
	$to->setLabel('Кому: ')
		->setOptions(array('size'=>15,'placeholder'=>'a.shandirov@gmail.com'))
		->setRequired(true)
		->addValidator('NotEmpty',true)
		->addFilter('StringTrim')
		->addFilter('HtmlEntities'); 

	$email= new Zend_Form_Element_Text('email');
	$email->setLabel('Ваш Email: ')
		->setOptions(array('size'=>15))
		->setRequired(true)
		->addValidator('NotEmpty',true)
		->addValidator('EmailAddress',true)
		->addFilter('StringToLower')
		->addFilter('StringTrim')
		->addFilter('HtmlEntities'); 

	$subject=new Zend_Form_Element_Text('subject');
	$subject->setLabel('Тема сообщения: ')
		->setOptions(array('size'=>25))
		->setRequired(false)
		->addValidator('NotEmpty',false)
		->addFilter('StringTrim')
		->addFilter('HtmlEntities');

	$message=new Zend_Form_Element_Textarea('message');
	$message->setLabel('Сообщение: ')
		->setOptions(array('cols'=>50,'rows'=>5))
		->setRequired(false)
		->addValidator('NotEmpty',true)
		->addFilter('StringTrim')
		->addFilter('HtmlEntities');

	$captcha= new Zend_Form_Element_Captcha('captcha',array(
	'label'=>'Введите капчу:',
	'options'=>array('size'=>5),
		'captcha'=>array(
			'captcha'=>'Image',
			'wordlen'=>5,
			'timeout'=>300,
			'width'=>150,
			'height'=>80,
			'imgUrl'=>'images/captcha',
			'fontsize'=>'28',
			'DotNoiseLevel'=>'10',
			'LineNoiseLevel'=>'10',
			'imgDir'=>APPLICATION_PATH . '/../public/images/captcha',
			'font'=>APPLICATION_PATH . '/../public/fonts/AA_typewriter.ttf',
			))
			);
	//$captcha->setOptions(array('size'=>5,'label'=>'Введите капчу'));

	$submit=new Zend_Form_Element_Submit('submit');
	$submit->setLabel('Отправить')
	->setOptions(array('class'=>'submit'));
	$this->addElements(array($from,$email,$subject,$message,$to,$captcha,$submit)); 
	}
}
